/**
 * 
 */
package v1c03;

/**
 * @author gjunming@gmail.com
 * @version Aug 5, 2009 1:14:19 PM
 */
public class TriangularLottery {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		final int NMAX = 10;

		// allocate array
		int[][] odds = new int[NMAX + 1][];
		for (int n = 0; n <= NMAX; n++) {
			odds[n] = new int[n + 1];
		}

		// fill array
		for (int n = 0; n < odds.length; n++) {
			for (int m = 0; m < odds[n].length; m++) {
				int lottery = 1;
				for (int i = 1; i <= m; i++) {
					lottery = lottery * (n - (i - 1) / i);
				}
				odds[n][m] = lottery;
			}
		}

		// output array
		for (int[] row : odds) {
			for (int odd : row) {
				System.out.printf("%4d", odd);
			}
			System.out.print("\n");
		}

	}

}
